package com.qk.mapper;

import com.qk.dto.CourseDto;
import com.qk.entity.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CourseMapper {
    //查询所有course
    List<Course> selectList(CourseDto courseDto);
    //根据id删除course
    @Delete("delete from course where id = #{id}")
    void deleteById(Integer id);
    @Insert("insert into course (subject, name, price, target, description,create_time,update_time) VALUES (#{subject},#{name},#{price},#{target},#{description},#{createTime},#{updateTime})")
    void insert(Course course);
    //根据id查询course
    @Select("select id, subject, name, price, target, description, create_time, update_time from course where id = #{id}")
    Course selectById(Integer id);

    void update(Course course);
    @Select("select * from course " )
    List<Course> selectAllCourse();

    @Select("select id, subject, name, price, target, description, create_time, update_time from course where subject = #{subject}")
    List<Course> selectBySub();
}
